public class Demo1 {
    public static void main(String[] args) {
        Object object = new Object();
        Thread t1 = new Thread(()->{
            synchronized(object){
                System.out.println("t1获取到锁");
            }
            System.out.println("t1出锁");
        });
        Thread t2 = new Thread(()->{
           synchronized(object){
               System.out.println("t2获取到锁");
           }
           System.out.println("t2出锁");
        });
        t1.start();
        t2.start();
    }
}
